#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back
#define vec vector<int>

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);return x*sgn;}

const int N = 210;
const int M = N * N + N * 2;
const db inf = 1e15;

int h[N],S,T,a[N][N],b[N][N],n,pre[N],incf[N],cnt,maxflow;
db dis[N],mid,cost;
bool vis[N];
struct edge{int v,w;db c;int nxt;}e[M];
void link(int x,int y,int w,db c){e[++cnt] = (edge){y,w,c,h[x]};h[x] = cnt;e[++cnt] = (edge){x,0,-c,h[y]};h[y] = cnt;}

bool spfa(){
	queue<int> q; for(int i = 1;i <= T;i++) dis[i] = -inf; dis[S] = 0; incf[S] = 0x3f3f3f3f; q.push(S); memset(vis,0,sizeof vis); vis[S] = 1;
	while(!q.empty()){
		int x = q.front(); q.pop(); 
		for(int i = h[x],y;i;i = e[i].nxt)
			if(e[i].w && dis[y = e[i].v] < dis[x] + e[i].c){
				dis[y] = dis[x] + e[i].c; pre[y] = i; incf[y] = min(incf[x],e[i].w); if(!vis[y]) q.push(y),vis[y] = 1;
			}
		vis[x] = 0;
	}return dis[T] > -inf;
}

void update(){
	int x = T; cost += incf[T] * dis[T]; maxflow += incf[T];
	while(x ^ S){
		int i = pre[x]; e[i].w -= incf[T]; e[i ^ 1].w += incf[T]; x = e[i ^ 1].v;
	}
}

bool check(){
	S = 0; T = n * 2 + 1; memset(h,0,sizeof h); cnt = 1; cost = 0; maxflow = 0;
	for(int i = 1;i <= n;i++) link(S,i,1,0),link(i + n,T,1,0);
	for(int i = 1;i <= n;i++) for(int j = 1;j <= n;j++) link(i,j + n,1,a[i][j] - b[i][j] * mid);
	while(spfa()) update(); return cost >= 0;
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1;i <= n;i++) for(int j = 1;j <= n;j++) a[i][j] = in; for(int i = 1;i <= n;i++) for(int j = 1;j <= n;j++) b[i][j] = in;
	db l = 0,r = 10000;
	for(int i = 1;i <= 60;i++){
		mid = (l + r) / 2; if(check()) l = mid; else r = mid;
	}printf("%.6lf\n",mid);
	return 0;
}
